const express = require('express')

const router = express.Router()

const teacher_handle = require('../router_handle/teacher.js')

//导入验证规则
const expressJoi = require('@escook/express-joi')
const { teacher_pwdschema, teacher_infoschema } = require('../schema/teacher')

// 导入解析formdata格式表单数据包
const multer = require('multer')
//导入处理路径的核心模块
const path = require('path')

var storage = multer.diskStorage({
    destination: function (req, file, cb) {
        cb(null, path.join(__dirname, '../upload'))
    },
    filename: function (req, file, cb) {
        cb(null, file.originalname)
    }
})

var upload = multer({ storage: storage })



//获取个人的信息
router.get('/get_teacherInfo', teacher_handle.get_teacherInfo)

//修改密码
router.post('/update_teacherPwd', expressJoi(teacher_pwdschema), teacher_handle.update_teacherPwd)

//修改个人信息
router.post('/update_teacherInfo', expressJoi(teacher_infoschema), teacher_handle.update_teacherInfo)

//获取所带学生的信息
router.get('/getStudentInfo', teacher_handle.getstudentinfo)

//获取需要通过的课题信息
router.get('/gettopic', teacher_handle.get_topic)

//选题确认按钮
router.post('/updatebutton', teacher_handle.update_button)

//不通过学生的选题
router.post('/unpass_choose', teacher_handle.unpass_choose)

//查看学生信息
router.get('/getAllinfo', teacher_handle.get_Allinfo)

//发送任务书文件,使用upload.single中间件,里面的名称最好和你要上传的数据库的名称1一致
router.post('/add', upload.single('file'), teacher_handle.add_charter)

//获取所带学生任务书的信息
router.get('/getstudentTask', teacher_handle.getstudentTask)

//教师发送留言
router.post('/send', teacher_handle.post_message)

//获取学生留言
router.post('/studentmessage', teacher_handle.studentmessage)

//填写指导记录
router.post('/writeRecord', teacher_handle.write_record)

//获取自己提交的课题信息
router.get('/teacaherTopic', teacher_handle.see_topic)

//发送课题信息
router.post('/sendTopic', teacher_handle.send_topic)

//发送课题信息
router.post('/choose_notice', teacher_handle.choose_notice)

//获取学生的开题报告
router.get('/get_report', teacher_handle.get_report)

//通过学生的开题报告
router.post('/pass_report', teacher_handle.pass_report)

//获取学生的论文
router.get('/student_paper', teacher_handle.student_paper)


//教师评分
router.post('/teacher_mark', teacher_handle.teacher_mark)

//评阅教师获取学生信息
router.get('/look_teacher', teacher_handle.look_teacher)


//评阅教师给学生分数
router.post('/lookTeacher_mark', teacher_handle.lookTeacher_mark)

//获取通过教师的开题的学生，并且分给小组长的学生
router.get('/group_student', teacher_handle.group_student)

//给学生开题报告提交意见
router.post('/group_idea', teacher_handle.group_idea)


//获取通过教师的毕业答辩的学生，并且分给小组长的学生
router.get('/graduation_group', teacher_handle.graduation_group)


//给学生论文提交分数
router.post('/group_score', teacher_handle.group_score)

//获取当前教师的开题答辩信息
router.get('/group_teacherinfo', teacher_handle.group_teacherinfo)


//获取当前教师的开题答辩信息
router.get('/group_teacherinfo2', teacher_handle.group_teacherinfo2)

//撤回不合格的终稿
router.post('/noPass', teacher_handle.noPass)

module.exports = router